A-Kind-Of relationship Comparison of
Point and Circle
class Point {
attributes:
int x, y
methods:
setX(int newX)
getX()
setY(int newY)
getY()
}
class Circle {
attributes:
int
x, y, radius
methods:
setX(int
newX)
getX()
setY(int
newY)
getY()
setRadius(newRadius)
getRadius()
}
Conclusion: Knowing the properties of
class Pointwe can describe
a circle as a point plus a radius and methods to access it.
A-Kind-Of
Comparing both class
definitions we can observe the following:
•Both classes have two data elements x and y. In the
class Point these elements describe the position of the point, in the
case of class Circle they describe the circle's center. Thus, x
and y have the same meaning in both classes: They describe the
position of their associated object by defining a point.
•Both classes offer the same set of methods to get and set the value of
the two data elements x and y.
•Class Circle ``adds'' a new data element radius and
corresponding access methods.